package com.carful.xigua.modules.common.advice;

import com.carful.xigua.modules.common.entity.Rest;
import com.carful.xigua.modules.common.entity.RestBody;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author Administrator
 * Date 2024/2/23 14:25
 * Description
 */
@RestControllerAdvice
@Order(100)
@Slf4j
public class UnknownExceptionHandler {

    // 未处理错误
    @org.springframework.web.bind.annotation.ExceptionHandler(Exception.class)
    public Rest<? extends Exception> exceptionHandler(Exception e) {
        log.error("未处理错误: ", e);
        return RestBody.build(500, e, e.getMessage(), null);
    }
}
